package com.enfi.api.modules.db.base;

import com.google.common.collect.Maps;
import lombok.Data;

import java.util.Map;

/**
 * @author wind
 * @date 2020/4/8
 */
@Data
public class MatchQuery {
    private String queryType="";
    private AndQuery and;
    private OrQuery or;
    private Map<String, RangeQuery> range=Maps.newHashMap();
    private Map<String, TermQuery> term=Maps.newHashMap();
    public void init(){
        if(range!=null&&range.size()>0){
            if(and==null){
                and=new AndQuery();
            }
            and.setRange(range);
        }
        if(term!=null&&term.size()>0){
            if(and==null){
                and=new AndQuery();
            }
            and.setTerm(term);
        }
    }
}
